export class ListItem
{
  body: string
  checked: boolean

  constructor(
    body?: string,
    checked?: boolean
  ) {
    this.body = body;
    this.checked = checked
  }

  toString(): string {
    let str = this.body + "^"
    str += this.checked ? "1" : "0"
    return str
  }
}

export function toListItem(str : string): ListItem {
  let strArr = str.split('^')
  let item: ListItem = new ListItem()
  item.body = strArr[0]
  item.checked = strArr[1] == "1"
  return item
}